import {instance} from "@/api/request.js";

const url = "/shop";

// export function login(account, password) {
//     return instance.post(url+"/login", null, {
//         params: {
//             account: account,
//             password: password
//         }
//     });
// }
// 查询购物车
export function getShoppingCart() {
    return instance.get(url+"/shopping_cart");
}
// 查询订单记录
export function getOrderForGoods() {
    return instance.get(url+"/order_for_goods/1");
}
// 查询我的商铺
export function getShop() {
    return instance.get(url+"/shop/0");
}
// 查询商品
export function getCommodity() {
    return instance.get(url+"/commodity");
}
// 查询我的商品
export function getMyCommodities() {
    return instance.get(url+"/commodity/mycommodities");
}
// 查询ID商品
export function getCommodityById(id) {
    return instance.get(url+"/commodity/1", {
        params: {
            id: id
        }
    });
}
// 查询ID商铺
export function getShopById(id) {
    return instance.get(url+"/shop/1", {
        params: {
            id: id
        }
    });
}
// 购买商品
export function buyCommodity(salesType, commodityId, commodityNum) {
    return instance.post(url+"/buy/"+salesType, null, {
        params: {
            id: commodityId,
            num: commodityNum
        }
    });
}
// 添加购物车
export function addShoppingCartApi(commodityId, commodityNum) {
    return instance.post(url+"/shopping_cart", null, {
        params: {
            commodityId: commodityId,
            num: commodityNum
        }
    });
}

